import request from '@/utils/request'
import fileAPI from '@/utils/fileAPI'
export function list(data) {
  return request({
    url: '/wms/material/list',
    method: 'post',
    data: data
  })
}
export function materialClassificationList(data) { // 物料分类列表
  return request({
    url: '/wms/type/treeselect',
    method: 'post',
    data: data
  })
}
export function materialClassificationRemove(data) {
  return request({
    url: '/wms/type/delete',
    method: 'post',
    data: { deleteIds: data }
  })
}
// 物料列表
export function listForSaleAndOut(data) {
  return request({
    url: '/wms/material/listForProductTask',
    method: 'post',
    data: data
  })
}
export function addOrUpdate(data) {
  return request({
    url: '/wms/material/addOrEdit',
    method: 'post',
    data: data
  })
}
export function remove(data) {
  return request({
    url: '/wms/material/delete',
    method: 'post',
    data: { deleteIds: data }
  })
}
export function getInfo(data) {
  return request({
    url: '/wms/material/' + data,
    method: 'get'
  })
}
export function materialCopy(data) {
  return request({
    url: '/wms/material/copy/' + data,
    method: 'get'
  })
}
export function getEngineeringRequirementsMaterialByPlanProductionDetailId(data) {
  return request({
    url: '/plan/production/getEngineeringRequirementsMaterialByPlanProductionDetailId/' + data,
    method: 'get'
  })
}
// export function getEngineeringRequirementsMaterialByPlanProductionDetailId(data) {
//   return request({
//     url: '/plan/production/getEngineeringRequirementsMaterialByPlanProductionDetailId',
//     method: 'post',
//     data: data
//   })
// }
export function getmateriaInfo(data) {
  return request({
    url: '/wms/material/' + data,
    method: 'get'
  })
}

export function materialList(data) {
  return request({
    url: '/wms/material/list',
    method: 'post',
    data: data
  })
}
export function importMethod(files) {
  const formData = new FormData()
  for (let i = 0; i < files.length; i++) {
    formData.append('file', files[i], files[i].name)
  }
  return fileAPI({
    url: '/wms/material/import',
    method: 'post',
    data: formData
  })
}

